Sparse Matrix Multiplication

Given two sparse matrices A and B, return the result of AB.

You may assume that A‘s column number is equal to B‘s row number.

Example:

  1. A = [
  2. [ 1, 0, 0],
  3. [-1, 0, 3]
  4. ]
  5. B = [
  6. [ 7, 0, 0 ],
  7. [ 0, 0, 0 ],
  8. [ 0, 0, 1 ]
  9. ]
  10. | 1 0 0 | | 7 0 0 | | 7 0 0 |
  11. AB = | -1 0 3 | x | 0 0 0 | = | -7 0 3 |
  12. | 0 0 1 |